version: "0.1"

services:
  # Runs the go-ethereum execution client with the specified, unlocked account and necessary
  # APIs to allow for proof-of-stake consensus via Prysm.
  geth:
    container_name: geth
    image: "ethereum/client-go:latest"
    command:
      - --http
      - --http.api=debug,net,eth,shh,web3,txpool,admin
      - --http.addr=0.0.0.0
      - --http.corsdomain=*
      - --ws
      - --ws.api=debug,net,eth,shh,web3,txpool,admin
      - --ws.addr=0.0.0.0
      - --ws.origins=*
      - --authrpc.vhosts=*
      - --authrpc.addr=0.0.0.0
      - --authrpc.jwtsecret=/jwtsecret/jwt.hex
      - --datadir=/execution
      - --allow-insecure-unlock
      - --unlock=0x123463a4b065722e99115d6c222f267d9cabb524
      - --password=/execution/password.txt
      - --nodiscover
      - --syncmode=full
    ports:
      - 8551:8551
      - 8545:8545
      - 8546:8546
    volumes:
      - ./execution:/execution
      - ./jwtsecret:/jwtsecret

  # Runs a Prysm beacon chain from a specified genesis state created in the previous step
  # and connects to go-ethereum in the same network as the execution client.
  # The account used in go-ethereum is set as the suggested fee recipient for transactions
  # proposed via the validators attached to the beacon node.
  beacon-chain:
    container_name: beacon_chain
    image: "gcr.io/prysmaticlabs/prysm/beacon-chain:v4.0.8"
    command:
      - --datadir=/consensus/beacondata
      # No peers to sync with in this testnet, so setting to 0
      - --min-sync-peers=0
      - --genesis-state=/consensus/genesis.ssz
      - --bootstrap-node=
      - --interop-eth1data-votes
      - --chain-config-file=/consensus/config.yaml
      # We specify the chain id used by our execution client
      - --contract-deployment-block=0
      - --chain-id=32382
      - --rpc-host=0.0.0.0
      - --grpc-gateway-host=0.0.0.0
      - --grpc-gateway-port=4100
      - --execution-endpoint=http://geth:85510
      - --accept-terms-of-use
      - --jwt-secret=/jwtsecret/jwt.hex
      - --suggested-fee-recipient=0x123463a4b065722e99115d6c222f267d9cabb524
      - --minimum-peers-per-subnet=0
      - --enable-debug-rpc-endpoints
    depends_on:
      geth:
        condition: service_started
    ports:
      - 4000:4000
      - 4100:4100
      - 3500:3500
      - 8080:8080
      - 8081:8080
      - 6060:6060
      - 9090:9090
    volumes:
      - ./consensus:/consensus
      - ./execution:/execution
      - ./jwtsecret:/jwtsecret

  # We run a validator client with 64, deterministically-generated keys that match
  # The validator keys present in the beacon chain genesis state generated a few steps above.
  validator:
    container_name: validator
    image: "gcr.io/prysmaticlabs/prysm/validator:v4.0.8"
    command:
      - --beacon-rpc-provider=beacon-chain:4000
      - --datadir=/consensus/validatordata
      - --accept-terms-of-use
      - --interop-num-validators=64
      - --interop-start-index=0
      - --chain-config-file=/consensus/config.yaml
    depends_on:
      beacon-chain:
        condition: service_started
    volumes:
      - ./consensus:/consensus
